package cn.microservices.cloud.system.service.convert;

import cn.microservices.cloud.system.api.bo.EmployeeBO;
import cn.microservices.cloud.system.api.bo.RegisterBO;
import cn.microservices.cloud.system.api.bo.UserInfoBO;
import cn.microservices.cloud.system.api.dto.RegisterDTO;
import cn.microservices.cloud.system.api.vo.RegisterVO;
import cn.microservices.cloud.system.api.vo.UserInfoVO;
import cn.microservices.cloud.system.dao.dataobject.EmployeeDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * 权限模块 实体转换 Controller -> Service
 */
@Mapper
public interface AuthConvert {

    AuthConvert INSTANCE = Mappers.getMapper(AuthConvert.class);

    RegisterVO convertBO(RegisterBO registerBO);
    RegisterVO convertBO(EmployeeBO registerBO);
    RegisterVO convertRegVo(EmployeeDO employeeDO);

    EmployeeDO convert(RegisterDTO registerDTO);

    EmployeeBO convert(EmployeeDO employeeDO);
    UserInfoVO convert(EmployeeBO employeeDO);

    @Mapping(source = "cellphone",target = "username")
    UserInfoBO convertUserInfoBO(EmployeeDO employeeDO);
}
